package elkins.main;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class WorkTimeActivity extends Activity 
{
	Button maxVolume;
	Button muteVolume;
	Button wifiOn;
	Button wifiOff;
	Button gpsOn;
	Button gpsOff;
	AudioManager audioManager;
	WifiManager wifi;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        maxVolume = (Button) findViewById(R.id.maxVolume);
        muteVolume = (Button) findViewById(R.id.muteVolume);
        wifiOn = (Button) findViewById(R.id.wifiOn);
        wifiOff = (Button) findViewById(R.id.wifiOff);
        maxVolume = (Button) findViewById(R.id.maxVolume);
        muteVolume = (Button) findViewById(R.id.muteVolume);
        wifiOn = (Button) findViewById(R.id.wifiOn);
        wifiOff = (Button) findViewById(R.id.wifiOff);
        audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
        wifi = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
        
    }
    
    @Override
    public void onResume()
    {
    	super.onResume();
    	maxVolume.setOnClickListener(new View.OnClickListener() 
    	{
			public void onClick(View v) 
			{
				audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
				audioManager.setStreamVolume(AudioManager.STREAM_ALARM, audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), 0);
				audioManager.setStreamVolume(AudioManager.STREAM_DTMF, audioManager.getStreamMaxVolume(AudioManager.STREAM_DTMF), 0);
				audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);
				audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, audioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION), 0);
				audioManager.setStreamVolume(AudioManager.STREAM_RING, audioManager.getStreamMaxVolume(AudioManager.STREAM_RING), 0);
				audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, audioManager.getStreamMaxVolume(AudioManager.STREAM_SYSTEM), 0);
				audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL), 0);
				Toast.makeText(getApplicationContext(), "Volume Maxed!", Toast.LENGTH_SHORT).show();
			}
		});
    	
    	muteVolume.setOnClickListener(new View.OnClickListener() 
    	{
			public void onClick(View v) 
			{
				audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
				audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 0, 0);
				audioManager.setStreamVolume(AudioManager.STREAM_DTMF, 0, 0);
				audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, 0);
				audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0);
				audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, 0);
				audioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, 0, 0);
				audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, 0, 0);
				Toast.makeText(getApplicationContext(), "Volume Muted!", Toast.LENGTH_SHORT).show();
			}
		});

    	wifiOn.setOnClickListener(new View.OnClickListener() 
    	{
			public void onClick(View v) 
			{
				wifi.setWifiEnabled(true);
				Toast.makeText(getApplicationContext(), "WiFi Enabled!", Toast.LENGTH_SHORT).show();
			}
		});

    	wifiOff.setOnClickListener(new View.OnClickListener() 
    	{
			public void onClick(View v) 
			{
				wifi.setWifiEnabled(false);
				Toast.makeText(getApplicationContext(), "WiFi Disabled!", Toast.LENGTH_SHORT).show();
			}
		});
    }
}